<template>
  <div id="app">
    <router-view></router-view>
  </div>
</template>

<script>
  import * as api from '@/api/api'

  export default {
    methods: {
      initJsSdk () {
        let config = {
          debug: true, // 开启调试模式,调用的所有api的返回值会在客户端alert出来，若要查看传入的参数，可以在pc端打开，参数信息会通过log打出，仅在pc端时才会打印。
          appId: '', // 必填，公众号的唯一标识
          timestamp: '', // 必填，生成签名的时间戳
          nonceStr: '', // 必填，生成签名的随机串
          signature: '', // 必填，签名，见附录1
          jsApiList: [
            'checkJsApi',
            'onMenuShareTimeline',
            'onMenuShareAppMessage',
            'onMenuShareQQ',
            'onMenuShareWeibo',
            'hideMenuItems',
            'showMenuItems',
            'hideAllNonBaseMenuItem',
            'showAllNonBaseMenuItem',
            'translateVoice',
            'startRecord',
            'stopRecord',
            'onRecordEnd',
            'playVoice',
            'pauseVoice',
            'stopVoice',
            'uploadVoice',
            'downloadVoice',
            'chooseImage',
            'previewImage',
            'uploadImage',
            'downloadImage',
            'getNetworkType',
            'openLocation',
            'getLocation',
            'hideOptionMenu',
            'showOptionMenu',
            'closeWindow',
            'scanQRCode',
            'chooseWXPay',
            'openProductSpecificView',
            'addCard',
            'chooseCard',
            'openCard'
          ] // 必填，需要使用的JS接口列表，所有JS接口列表见附录2
        }
        api.post({
          url: '/wx/msg/getJSSDK',
          data: {url: window.location.href},
          // data: {url: 'http://jssy.edik.cn' + this.$route.path},
          success: data => {
            // console.log(data)
            Object.assign(config, data.data)
            config.debug = false
            this.$wx.config(config)
          }
        })
      }
    },
    components: {},
    mounted () {
      this.initJsSdk()
    }
  }
</script>

<style>
  body {
    background-color: #fff;
  }

  #app, body, html {
    height: 100%;
    min-height: 100%;
  }

  #app {
  }
</style>

